package com.qianfeng.zhangwei.xutils.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.lidroid.xutils.BitmapUtils;
import com.qianfeng.zhangwei.xutils.R;
import com.qianfeng.zhangwei.xutils.bean.Banner;

import java.util.List;

/**
 * @说 明：
 * @项目名称：Sz1504Adv
 * @包 名： com.qianfeng.zhangwei.xutils
 * @类 名： HomeAdapter
 * @创 建人： zhangwei
 * @创建时间：2015-08-04 16:10
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */
public class HomeAdapter extends BaseAdapter {
    private Context context;
    private List<Banner> banners;
    private BitmapUtils bitmapUtils;

    private LayoutInflater inflater;


    public HomeAdapter(Context context, List<Banner> banners, BitmapUtils bitmapUtils) {
        this.context = context;
        this.banners = banners;
        this.bitmapUtils = bitmapUtils;
        inflater = LayoutInflater.from(context);
//        BitmapDisplayConfig config = new BitmapDisplayConfig();
//        config.setBitmapConfig(Bitmap.Config.RGB_565);
//        config.setLoadFailedDrawable(context.getResources().getDrawable(R.mipmap.ic_launcher));
//        config.setLoadingDrawable(context.getResources().getDrawable(R.mipmap.ic_launcher);
//
        bitmapUtils.configDefaultLoadFailedImage(R.mipmap.ic_launcher);
        bitmapUtils.configDefaultLoadFailedImage(R.mipmap.ic_launcher);


    }

    @Override
    public int getCount() {
        return banners.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
//        ViewHolder vh;

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.widget_item_home_layout, parent, false);
//            vh = new ViewHolder(convertView);
//            convertView.setTag(vh);
        } else {
//            vh = (ViewHolder) convertView.getTag();
        }
//        bitmapUtils.display(vh.imageView, banners.get(position).getPhoto());

        return null;
    }

//    private static class ViewHolder {
//        @ViewInject(R.id.item_home_img)
//        private ImageView imageView;
//
//        public ViewHolder(View convertView) {
//            ViewUtils.inject(this, convertView);
//        }
//    }


}
